﻿<?xml version="1.0" encoding="utf-8"?>
<!--
    This file is part of "Information Connections Engine".

    "Information Connections Engine" is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 2 of the License, or
    (at your option) any later version.

    "Information Connections Engine" is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with "Information Connections Engine".  If not, see http://www.gnu.org/license.
-->
<xs:schema
    targetNamespace="InformationConnectionsEngine.settings"
    elementFormDefault="qualified"
    xmlns="InformationConnectionsEngine.settings"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>

  <xs:simpleType name="Coeficient">
    <xs:restriction base="xs:string">
      <xs:pattern value="([0-9])*(\.([0-9])*)?([%])?"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:simpleType name="gravityType">
    <xs:restriction base="xs:integer">
      <xs:maxInclusive value="10"/>
      <xs:minInclusive value="-10"/>
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="NodeStyle">
    <xs:sequence>
      <xs:element name="className" minOccurs="0" maxOccurs="1" type="xs:string"/>
      <xs:element name="drawingInformation" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:any minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
      <xs:element name="relativeSize" minOccurs="0" maxOccurs="1" type="Coeficient"/>
    </xs:sequence>
    <xs:attribute name="id" type="xs:ID"/>
  </xs:complexType>

  <xs:complexType name="LinkStyle">
    <xs:sequence>
      <xs:element name="className" minOccurs="0" maxOccurs="1" type="xs:string"/>
      <xs:element name="drawingInformation" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:any minOccurs="0" maxOccurs="unbounded"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" type="xs:ID"/>
  </xs:complexType>

  <xs:complexType name="DrawPopupTask">
    <xs:attribute name="name"/>
  </xs:complexType>

  <xs:complexType name="GuiTask">
    <xs:attribute name="name"/>
  </xs:complexType>

  <xs:complexType name="JavascriptTask">
    <xs:attribute name="name"/>
  </xs:complexType>

  <xs:simpleType name="Octet">
    <xs:restriction base="xs:hexBinary">
      <xs:length value="1" />
    </xs:restriction>
  </xs:simpleType>

  <xs:complexType name="Color">
    <xs:all>
      <xs:element name="red" type="Octet"/>
      <xs:element name="green" type="Octet"/>
      <xs:element name="blue" type="Octet"/>
      <xs:element name="alpha" type="Octet"/>
    </xs:all>
  </xs:complexType>

  <xs:complexType name="Action">
    <xs:sequence>
      <xs:element name="description" minOccurs="0" maxOccurs="1" type="xs:string"/>
      <xs:element name="iconURL" minOccurs="0" maxOccurs="1" type="xs:string"/>
      <xs:element name="tasks" minOccurs="0" maxOccurs="1">
        <xs:complexType>
          <xs:sequence>
            <xs:element name="guiTask" minOccurs="0" maxOccurs="unbounded" type="GuiTask"/>
            <xs:element name="javascriptTask" minOccurs="0" maxOccurs="unbounded" type="JavascriptTask"/>
          </xs:sequence>
        </xs:complexType>
      </xs:element>
    </xs:sequence>
    <xs:attribute name="id" type="xs:ID"/>
  </xs:complexType>

  <xs:element name="iceSettings">
    <xs:complexType>
      <xs:sequence>
        <xs:element name="modes" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="debug" minOccurs="0" maxOccurs="1"/>
              <xs:element name="multiNodeSelection" minOccurs="0" maxOccurs="1"/>
              <xs:element name="navigationBar" minOccurs="0" maxOccurs="1"/>
              <xs:element name="navigationMenu" minOccurs="0" maxOccurs="1"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="constants" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="drawingConstants" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="actionsCircleColor" minOccurs="0" maxOccurs="1" type="Color"/>
                    <xs:element name="background" minOccurs="0" maxOccurs="1" type="xs:string"/>
                    <xs:element name="initialZoomRatio" minOccurs="0" maxOccurs="1" type="Coeficient"/>
                    <xs:element name="initialGraphVisibilityDepth" minOccurs="0" maxOccurs="1" type="xs:nonNegativeInteger"/>
                    <xs:element name="linkMaximalThickness" minOccurs="0" maxOccurs="1" type="Coeficient"/>
                    <xs:element name="linkMinimalThickness" minOccurs="0" maxOccurs="1" type="Coeficient"/>
                    <xs:element name="nodeSize" minOccurs="0" maxOccurs="1" type="Coeficient"/>
                    <xs:element name="opacityChangeStep" minOccurs="0" maxOccurs="1" type="xs:double"/>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="downloadConstants" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="maximumDownloadPerMinute" minOccurs="0" maxOccurs="1" type="xs:positiveInteger"/>
                    <xs:element name="maximumSimultaneousDownload" minOccurs="0" maxOccurs="1" type="xs:positiveInteger"/>
                    <xs:element name="timeout" minOccurs="0" maxOccurs="1" type="xs:positiveInteger"/>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="modelConstants" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="cleanUpAdditionalDepth" minOccurs="0" maxOccurs="1" type="xs:nonNegativeInteger"/>
                    <xs:element name="maximumNodes" minOccurs="0" maxOccurs="1" type="xs:positiveInteger"/>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
              <xs:element name="physicsConstants" minOccurs="0" maxOccurs="1">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element name="fluidResistance" minOccurs="0" maxOccurs="1" type="xs:float"/>
                    <xs:element name="gravity" minOccurs="0" maxOccurs="1" type="gravityType"/>
                    <xs:element name="springRestLenght" minOccurs="0" maxOccurs="1" type="xs:float"/>
                    <xs:element name="repultionStrength" minOccurs="0" maxOccurs="1" type="xs:float"/>
                  </xs:sequence>
                </xs:complexType>
              </xs:element>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
        <xs:element name="nodeStyles" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="nodeStyle" type="NodeStyle" maxOccurs="unbounded" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="default" type="xs:IDREF" use="optional"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="linkStyles" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="linkStyle" type="LinkStyle" maxOccurs="unbounded" minOccurs="0"/>
            </xs:sequence>
            <xs:attribute name="default" type="xs:IDREF" use="optional"/>
          </xs:complexType>
        </xs:element>
        <xs:element name="actions" minOccurs="0" maxOccurs="1">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="action" type="Action" maxOccurs="unbounded" minOccurs="0"/>
              <xs:element name="groupAction" type="Action" maxOccurs="unbounded" minOccurs="0"/>
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

</xs:schema>
